/*
 * PopupImage.hpp
 *
 *  Created on: Jul 7, 2013
 *      Author: guillou
 */

#ifndef POPUPIMAGE_HPP_
#define POPUPIMAGE_HPP_

#include <vector>
#include <QImage>
#include <QPainter>

class PopupImageViewer;
struct PopupImageFx;

class PopupImage
{
public:
  PopupImage(PopupImageViewer *p_parent,
             QString p_imagePath,
             QString p_senderName,
             bool p_isFullscreen);
  ~PopupImage();

  void paint(QPainter & p_painter);
  //! Apply each active effect on image.
  //! \return true   if at least one effect needs to be called again
  //!                in order to finish
  bool applyFx();

  bool isNull() { return !valid; }
  bool hasDynamicEffects() { return (nbDynamicFx > 0); }

  PopupImageViewer *parent;
  bool valid;
  QString m_imagePath;
  QString m_sender;
  QImage *m_image;

  int currentImageWidth;
  int currentImageHeight;
  int finalImageWidth;
  int finalImageHeight;
  int currentX;
  int currentY;
  int finalX;
  int finalY;
  int nbDynamicFx;
  std::vector<PopupImageFx*> effects;

private:
  PopupImage(const PopupImage &) {}
};


#endif /* POPUPIMAGE_HPP_ */
